<!DOCTYPE html>
<html>
<head>
<title>定时任务</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/font-awesome.min.css">
<link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="../../plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../../css/main.css">
<script src="../../libs/jquery.min.js"></script>
<script src="../../plugins/layer/layer.js"></script>
<script src="../../libs/bootstrap.min.js"></script>
<script src="../../libs/vue.min.js"></script>
<script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="../../js/common.js"></script>
<script>
$(document).ready(function(){
var top ="0 ";
var last="* ?";
var minutes="* ";
var hour="* ";
var day="* ";

$("#minutes").change(function(){
    minutes = $("#minutes").val()+" ";  
	document.getElementById("cron").value =(top+minutes+hour+day+last);
})

$("#hour").change(function(){
   hour=$("#hour").val()+" ";  
	document.getElementById("cron").value =(top+minutes+hour+day+last);
})

$("#day").change(function(){
   day = $("#day").val()+" ";  
   document.getElementById("cron").value =(top+minutes+hour+day+last);
})

})

</script>
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn" style="height:34px;">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.beanName" @keyup.enter="query" placeholder="bean名称">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<a v-if="hasPermission('sys:schedule:save')" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			<a v-if="hasPermission('sys:schedule:update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			<a v-if="hasPermission('sys:schedule:delete')" class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			<a v-if="hasPermission('sys:schedule:pause')" class="btn btn-primary" @click="pause"><i class="fa fa-pause"></i>&nbsp;暂停</a>
			<a v-if="hasPermission('sys:schedule:resume')" class="btn btn-primary" @click="resume"><i class="fa fa-play"></i>&nbsp;恢复</a>
			<a v-if="hasPermission('sys:schedule:run')" class="btn btn-primary" @click="runOnce"><i class="fa fa-arrow-circle-right"></i>&nbsp;立即执行</a>
			<a v-if="hasPermission('sys:schedule:log')" class="btn btn-danger" style="float:right;" href="schedule_log.html">日志列表</a>
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
	</div>
	
	<div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal">
			<div class="form-group">
			   	<div class="col-sm-2 control-label">bean名称</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="schedule.beanName" placeholder="spring bean名称，如：testTask"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">方法名称</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="schedule.methodName" placeholder="方法名称"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">参数</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="schedule.params" placeholder="参数"/>
			    </div>
			</div>
			
			<div class="form-group">			
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			分:
			<select id="minutes">
			  <option value="*"> *</option>			
			  <option value="0">00</option>
			  <option value="1">01</option>
			  <option value="2">02</option>
			  <option value="3">03</option>
			  <option value="4">04</option>
			  <option value="5">05</option>
			  <option value="6">06</option>
			  <option value="7">07</option>
			  <option value="8">08</option>
			  <option value="9">09</option>
			  <option value="10">10</option>
			  <option value="11">11</option>
			  <option value="12">12</option>
			  <option value="13">13</option>
			  <option value="14">14</option>
			  <option value="15">15</option>
			  <option value="16">16</option>
			  <option value="17">17</option>
			  <option value="18">18</option>
			  <option value="19">19</option>
			  <option value="20">20</option>
			  <option value="21">21</option>
			  <option value="22">22</option>
			  <option value="23">23</option>
			  <option value="24">24</option>
			  <option value="25">25</option>
			  <option value="26">26</option>
			  <option value="27">27</option>
			  <option value="28">28</option>
			  <option value="29">29</option>
			  <option value="30">30</option>
			  <option value="31">31</option>
			  <option value="32">32</option>
			  <option value="33">33</option>
			  <option value="34">34</option>
			  <option value="35">35</option>
			  <option value="36">36</option>
			  <option value="37">37</option>
			  <option value="38">38</option>
			  <option value="39">39</option>
			  <option value="40">40</option>
			  <option value="41">41</option>
			  <option value="42">42</option>
			  <option value="43">43</option>
			  <option value="44">44</option>
			  <option value="45">45</option>
			  <option value="46">46</option>
			  <option value="47">47</option>
			  <option value="48">48</option>
			  <option value="49">49</option>
			  <option value="50">50</option>
			  <option value="51">51</option>
			  <option value="52">52</option>
			  <option value="53">53</option>
			  <option value="54">54</option>
			  <option value="55">55</option>
			  <option value="56">56</option>
			  <option value="57">57</option>
			  <option value="58">58</option>
			  <option value="59">59</option>
			</select>
			小时:
			<select id="hour">
			  <option value="*"> *</option>
			  <option value="0">00</option>
			  <option value="1">01</option>
			  <option value="2">02</option>
			  <option value="3">03</option>
			  <option value="4">04</option>
			  <option value="5">05</option>
			  <option value="6">06</option>
			  <option value="7">07</option>
			  <option value="8">08</option>
			  <option value="9">09</option>
			  <option value="10">10</option>
			  <option value="11">11</option>
			  <option value="12">12</option>
			  <option value="13">13</option>
			  <option value="14">14</option>
			  <option value="15">15</option>
			  <option value="16">16</option>
			  <option value="17">17</option>
			  <option value="18">18</option>
			  <option value="19">19</option>
			  <option value="20">20</option>
			  <option value="21">21</option>
			  <option value="22">22</option>
			  <option value="23">23</option>
			</select>
			日:
			 <select id="day">
			  <option value="*"> *</option>
			  <option value="1">01</option>
			  <option value="2">02</option>
			  <option value="3">03</option>
			  <option value="4">04</option>
			  <option value="5">05</option>
			  <option value="6">06</option>
			  <option value="7">07</option>
			  <option value="8">08</option>
			  <option value="9">09</option>
			  <option value="10">10</option>
			  <option value="11">11</option>
			  <option value="12">12</option>
			  <option value="13">13</option>
			  <option value="14">14</option>
			  <option value="15">15</option>
			  <option value="16">16</option>
			  <option value="17">17</option>
			  <option value="18">18</option>
			  <option value="19">19</option>
			  <option value="20">20</option>
			  <option value="21">21</option>
			  <option value="22">22</option>
			  <option value="23">23</option>
			  <option value="24">24</option>
			  <option value="25">25</option>
			  <option value="26">26</option>
			  <option value="27">27</option>
			  <option value="28">28</option>
			  <option value="29">29</option>
			  <option value="30">30</option>
			  <option value="31">31</option>
			</select>
			</div>
			
			<div class="form-group">
			   	<div class="col-sm-2 control-label">cron表达式</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="schedule.cronExpression" value="* * * * * ?" id="cron" readonly="readonly" />
			    </div>
			</div>
			
			<div class="form-group">
			   	<div class="col-sm-2 control-label">备注</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="schedule.remark" placeholder="备注"/>
			    </div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label"></div> 
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>
</div>

<script src="../../js/modules/job/schedule.js"></script>
</body>
</html>